import request from '@/utils/request'

export function getPage(query) {
  return request({
    url: '/web-api/api/dept/page',
    method: 'get',
    params: query
  })
}
// 根据当前用户获取部门同级与上级数据
export function getPageOwnSuperior(query) {
  return request({
    url: '/web-api/api/dept/ownSuperior',
    method: 'get',
    params: query
  })
}

export function add(data) {
  return request({
    url: '/web-api/api/dept',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: '/web-api/api/dept',
    method: 'delete',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: '/web-api/api/dept',
    method: 'put',
    data
  })
}

export function getList(query) {
  return request({
    url: '/web-api/api/dept/list',
    method: 'get',
    params: query
  })
}

export function getTree(query) {
  return request({
    url: '/web-api/api/dept/deptTree',
    method: 'get',
    params: query
  })
}

export function getDeptByRegionId(id) {
  return request({
    url: '/web-api/api/dept/findByRegionId?regionId='+id,
    method: 'get',
  })
}

export const downloadUrl = '/web-api/api/dept/download'
